﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;

namespace Silvermoon.Navigation
{
    internal class PageTypeKey
    {
        public Type From { get; private set; }
        public Type To { get; private set; }
        private int hashCode;

        public PageTypeKey(Type from, Type to)
        {
            Set(from, to);
        }

        public void Set(Type from, Type to)
        {
            this.From = from;
            this.To = to;
            int t1 = From.GetHashCode();
            int t2 = To.GetHashCode();
            hashCode = t1 ^ t2;
        }


        public override bool Equals(object obj)
        {
            PageTypeKey t = obj as PageTypeKey;
            if (t == null) return false;

            return From == t.From && To == t.To;
        }

        public override int GetHashCode()
        {
            return hashCode;
        }
    }
}
